Cache#533
Open
xsuchy wants to merge 2 commits into
Open
Conversation
Usage page data changes infrequently and is expensive to fetch from the upstream API. Flask now proxies /api/usage/ requests and caches responses as JSON files in /tmp/packit-dashboard-usage-cache/, keyed by endpoint and date. All WSGI workers share the same file-based cache. Stale files from previous days are evicted on cache miss. Frontend fetches usage data from the Flask proxy (same origin) instead of the external API directly. Tabs render all content eagerly (removed mountOnEnter) so all data loads upfront. Vite dev server proxies /api/usage to localhost Flask for local development. - Flask proxy with file-based daily cache over in-memory dict to share across WSGI workers - Frontend switched from VITE_API_URL to relative /api/usage/ paths - All tabs rendered immediately instead of on-demand Assisted-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract cache logic into cache.py module shared by Flask routes and the new warm_cache.py script. The startup script pre-warms the cache on boot and schedules a background loop that re-fetches all usage endpoints at 00:01 each day. - No crond needed — background sleep loop in run_httpd.sh calculates seconds until next 00:01 and sleeps precisely - Cache files in /tmp shared across WSGI workers, warm_cache populates them before any user request hits Assisted-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Build succeeded. ✔️ pre-commit SUCCESS in 1m 39s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TODO:
packit/packit.dev.Added server-side daily caching for the usage page. Flask proxies usage API calls, caches responses as files in /tmp, and a background loop refreshes them at 00:01 daily. Both commits are done, nothing pending. (disable recaps in /config)
RELEASE NOTES BEGIN
Dashboard statistics are now cached on the server side for all processes together and pre-generated automatically after midnight.
RELEASE NOTES END